# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/realplayer/realplayer-10.0.8-r2.ebuild,v 1.1 2007/02/18 15:43:29 beandog Exp $

inherit nsplugins eutils rpm

MY_PN="HelixPlayer"
DESCRIPTION="Helix Media Player"
HOMEPAGE="https://player.helixcommunity.org/"
SRC_URI="https://helixcommunity.org/download.php/2152/${MY_PN}-${PV}-20070402.i586.rpm"
LICENSE="HBRL"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="X nsplugin"
RDEPEND="!amd64? (
			X? ( >=dev-libs/glib-2
				>=x11-libs/pango-1.2
				>=x11-libs/gtk+-2.2 )
			=virtual/libstdc++-3.3*
		)
		amd64? (
			X? ( app-emulation/emul-linux-x86-gtklibs )
			app-emulation/emul-linux-x86-compat
		)"
RESTRICT="strip nomirror test"

#QA_TEXTRELS="opt/HelixPlayer/codecs/colorcvt.so
#/opt/HelixPlayer/plugins/audplin.so
#/opt/HelixPlayer/plugins/aufformat.so
#/opt/HelixPlayer/plugins/authmgr.so
#/opt/HelixPlayer/plugins/clbascauth.so
#/opt/HelixPlayer/plugins/dtdrplin.so
#/opt/HelixPlayer/plugins/giffformat.so
#/opt/HelixPlayer/plugins/gifrender.so
#/opt/HelixPlayer/plugins/h263render.so
#/opt/HelixPlayer/plugins/httpfsys.so
#/opt/HelixPlayer/plugins/hxsdp.so
#/opt/HelixPlayer/plugins/hxxml.so
#/opt/HelixPlayer/plugins/jpgfformat.so
#/opt/HelixPlayer/plugins/jpgrender.so
#/opt/HelixPlayer/plugins/memfsys.so
#/opt/HelixPlayer/plugins/oggfformat.so
#/opt/HelixPlayer/plugins/pcmrend.so
#/opt/HelixPlayer/plugins/pngfformat.so
#/opt/HelixPlayer/plugins/pngrender.so
#/opt/HelixPlayer/plugins/ramfformat.so
#/opt/HelixPlayer/plugins/ramrender.so
#/opt/HelixPlayer/plugins/rn5auth.so
#/opt/HelixPlayer/plugins/rpfformat.so
#/opt/HelixPlayer/plugins/rpgifplin.so
#/opt/HelixPlayer/plugins/rpjpgplin.so
#/opt/HelixPlayer/plugins/rppngplin.so
#/opt/HelixPlayer/plugins/rprender.so
#/opt/HelixPlayer/plugins/rtfformat.so
#/opt/HelixPlayer/plugins/rtrender.so
#/opt/HelixPlayer/plugins/sdpplin.so
#/opt/HelixPlayer/plugins/smlfformat.so
#/opt/HelixPlayer/plugins/smlrender.so
#/opt/HelixPlayer/plugins/smplfsys.so
#/opt/HelixPlayer/plugins/theorarend.so
#/opt/HelixPlayer/plugins/vidsite.so
#/opt/HelixPlayer/plugins/vorbisrend.so
#/opt/HelixPlayer/plugins/wbmpfformat.so
#/opt/HelixPlayer/plugins/wbmprend.so"

S="${WORKDIR}/opt/helix/${MY_PN}"

pkg_setup() {
	# This is a binary x86 package => ABI=x86
	# Please keep this in future versions
	# Danny van Dyk <kugelfang@gentoo.org> 2005/03/26
	has_multilib_profile && ABI="x86"
}

src_unpack() {
	rpm_src_unpack

	dosed -i -e 's:hxplay.png:hxplay:' ${S}/share/hxplay.desktop
}

src_install() {
	dodir /opt/${MY_PN}

	fperms 644 codecs/*
	insinto /opt/${MY_PN}/codecs
	doins codecs/*
	for x in drvc drv2 atrc sipr; do
		dosym ${x}.so /opt/${MY_PN}/codecs/${x}.so.6.0
	done

	cd ${S}
	dodoc README
	dohtml share/hxplay_help.html share/tigris.css

	if use X; then
		for x in common mozilla plugins postinst hxplay hxplay.bin share; do
			mv $x ${D}/opt/${MY_PN}
		done;

		dodir /usr/bin
		dosym /opt/${MY_PN}/hxplay /usr/bin/hxplay

		cd ${D}/opt/${MY_PN}/share
		domenu hxplay.desktop

		for res in 16 192 32 48; do
			insinto /usr/share/icons/hicolor/${res}x${res}/apps
			newins icons/hxplay_${res}x${res}.png \
					hxplay.png
		done

		# mozilla plugin
		if use nsplugin ; then
			cd ${D}/opt/${MY_PN}/mozilla
			exeinto /opt/netscape/plugins
			doexe nphelix.so
			inst_plugin /opt/netscape/plugins/nphelix.so

			insinto /opt/netscape/plugins
			doins nphelix.xpt
			inst_plugin /opt/netscape/plugins/nphelix.xpt
		fi

		# Language resources
		cd ${D}/opt/HelixPlayer/share/locale
		for LC in *; do
			mkdir -p ${D}/usr/share/locale/${LC}/LC_MESSAGES
			dosym /opt/HelixPlayer/share/locale/${LC}/player.mo /usr/share/locale/${LC}/LC_MESSAGES/hxplay.mo
			dosym /opt/HelixPlayer/share/locale/${LC}/widget.mo /usr/share/locale/${LC}/LC_MESSAGES/libgtkhx.mo
		done
	fi
}
